<?php


namespace Yj\Apidog\Annotation;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Mapping;

/**
 * Annotation class for @PostApi().
 *
 * @Annotation
 * @Target({"METHOD"})
 *
 */
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_PROPERTY)]
class TestApi extends Mapping
{

    public $path;

    public $summary;

    public $description;

    public $deprecated;

    public $methods = ['POST'];

//    public function __construct(...$value)
//    {
//        parent::__construct(...$value);
//        $this->bindMainProperty('path', $value);
//    }

    public function __construct(...$value)
    {
        parent::__construct(...$value);
        if (is_array($value)) {
            foreach ($value as $key => $val) {
                if (property_exists($this, $key)) {
                    $this->{$key} = $val;
                }
            }
        }
    }


}